package nl.hva.three2learn.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Table(name = "course_category")
@Entity
public final class Category implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1367145699316416580L;

	@Id
	@GeneratedValue
	@Column(name = "category_id")
	private long id;

	@Column(name = "name")
	private String name;

	@OneToMany
	@LazyCollection(LazyCollectionOption.FALSE)
	private List<Course> courses;

	public Category() {
	}

	public Category(String name) {
		this.name = name;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Course> getCourses() {
		return courses;
	}

	public void setCourses(List<Course> courses) {
		this.courses = courses;
	}
}
